package com.pagepub.expo.manager;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.flex.remoting.RemotingInclude;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.pagepub.expo.dao.CorpPavilionCommpanyDao;
import com.pagepub.expo.entity.CorpPavilionCommpany;

@Service
@Transactional
@RemotingDestination(channels = { "my-amf", "my-secure-amf" })
public class CorpPavilionCommpanyMng {
	@Autowired
	private CorpPavilionCommpanyDao corpPavilionCommpanyDao;


	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public List<CorpPavilionCommpany> findAll() {
		return corpPavilionCommpanyDao.findAll();
	}
	
	
	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public int getCount(Map<String, String> param){
		return corpPavilionCommpanyDao.getCount(param);
	}
	
	@RemotingInclude
	@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
	public List<CorpPavilionCommpany> findByPage(int currentPage,int pageSize,Map<String, String> param){
		return corpPavilionCommpanyDao.findByPage(currentPage, pageSize, param);
	}


	@RemotingInclude
	public CorpPavilionCommpany add(CorpPavilionCommpany bean) {
		corpPavilionCommpanyDao.insert(bean);
		return corpPavilionCommpanyDao.findById(new Long(bean.getId()));
	}

	@RemotingInclude
	public Long remove(Long id) {
		corpPavilionCommpanyDao.delete(id);
		return id;
	}

	@RemotingInclude
	public CorpPavilionCommpany update(CorpPavilionCommpany bean) {
		corpPavilionCommpanyDao.update(bean);
		return corpPavilionCommpanyDao.findById(new Long(bean.getId()));
	}
}
